package com.itqf.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.io.IOException;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/19
 * @Time: 下午2:37
 */
public class BackDbJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            //创建Runtime类
            Runtime runtime = Runtime.getRuntime();
            //执行备份数据库的命令 javac  java
            //c://file program/mysql/bin/
            runtime.exec("mysqldump -uroot -padmin ttshop -r /Users/liliting/Desktop/part3/_21QuartzDemo01/sql/ttshop.sql");
            System.out.println("备份成功！");
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
